package myCine;

import java.util.List;

import myCine.alloCine.controller.SearchManager;
import myCine.alloCine.model.app.criteriaOfSearch.MovieCriteria;
import myCine.alloCine.view.Window;
import myCine.alloCine.view.resources.Resources;
import utils.FileUtils;
import utils.StringUtils;

//http://wiki.gromez.fr/dev/api/allocine_v3#ils_se_servent_de_l_api
//http://jsongen.byingtondesign.com/
public class Main {
	
    public static void main( String[] args ) throws Exception
    { 
    	
    	//View
    	Window window = new Window(Resources.LANGUAGE_FR);
    	
    	//Controller
    	SearchManager searchManager = new SearchManager();
    	
    	//Model
    	String listOfTitles = FileUtils.readFile("listOfMovies.txt");
    	List<String> readSplitAndPrepare = StringUtils.split(listOfTitles, ",");
    	String listOfCriterias = FileUtils.readFile("criteria.txt");
    	List<String> readCriterias = StringUtils.split(listOfCriterias, "/");
    	readCriterias.remove(0); //on supprime la ligne d'explication
    	
    	//Request
    	MovieCriteria movieCriteria = new MovieCriteria(new Integer(readCriterias.get(0)),new Double(readCriterias.get(1)),new Integer(readCriterias.get(2)));
//    	SearchResult searchresult = searchManager.getListOfMovies(readSplitAndPrepare, movieCriteria);
    	
    	//Result
//    	String result = view.diplsayAll(searchresult);
//    	System.out.println(result);
//    	FileUtils.writeInFile("requestResults.txt", result);
    }
}
